Add support for GameInput API on Windows#116055
Add support for GameInput API on Windows#116055Nintorch wants to merge 1 commit intogodotengine:masterfrom
Conversation
This won't work, since the official build system won't have them and users making custom builds won't have them. What can be done is making this optional (with Scons argument) and add download script for the headers, like we do for DX12 stuff (see install_d3d12_sdk_windows.py). |
|
This driver broke controller mapping for my DInput controller :( I will work on fixing this issue. |
|
I have fixed the mapping issue, but I think this PR would definitely conflict with #114642 , not sure if a controller that was opened with the GameInput driver can be used with DirectInput haptic effects. Maybe if we decide to use GameInput instead of DirectInput, I or someone else would have to create an SDL haptic driver for GameInput :( And also GameInput doesn't support retrieving input from devices if the application is not in focus, unless I can do something with it. |
|
Made a PR that may or may not be better than this approach in the short term: #116101 |
|
GameInput installation script is done and it makes the GCC Windows template compile! |
5f968fa to
cace447
Compare
cace447 to
2be7de7
Compare
|
Here's something that I observed when I added several And I'm pretty sure that XInput controllers other than the ones from Xbox don't have a human-readable name in this PR either. I don't have other XInput controllers to check that though. In this case, what name should we assign to those controllers: "XInput Controller # .." to not break compatibility or "GameInput Controller"? EDIT: I decided to use "GameInput Gamepad", I will add a new commit here soon. |
a63674a to
87ca4d5
Compare
|
Now that I think about it, is it possible to check later if this PR breaks Xbox controllers in Windows Godot apps under Wine or Proton? |
|
quick questions: i've heard claims GameInput seem to cause "FPS Drops" if a Xbox Controller is connected, the solution seems to be to disable GameInput Service directly. This solution seems to apply to selected games like Gears of War: Reloaded and Marathon (2026) despite actual GameInput API usage is currently unverified. since that claim could be dubious, I think it's possible to do a benchmark test to see if it's true? |
|
As it turns out, there have been quite a few modifications to the GameInput joystick backend in SDL 3.4, so I will need to update this PR to use those changes if possible. https://github.com/libsdl-org/SDL/blob/release-3.4.x/src/joystick/gdk/SDL_gameinputjoystick.cpp EDIT: Done! This change also allowed GameInput to properly report device names. |
87ca4d5 to
fc3929a
Compare
I tried to test it by disabling VSync and printing FPS, but I couldn't find any differences at the moment |
|
I've been trying to chase around the 5+ controller Windows issue on GitHub - is this PR the latest on that front? I want to make sure I'm notified when a potential solution emerges so I can test on my game 🙏 |
This PR is indeed the latest one about solving the issue of using more than 4 Xbox/XInput controllers on Windows! :) |
This PR enables GameInput API backend for SDL on Windows. I know we have already discussed this API here, but in this PR we don't include GameInput headers/code, GameInput is downloaded with a script here, so it should be okay.
This PR also removes unused backends in Godot (RawInput, WGI). DirectInput is not replaced by GameInput in this PR for devices with force feedback (racing wheels) since it's still used because of the haptics subsystem and #114642 ,
and XInput is used as a fallback if GameInput is not enabled in the build (if GameInput is enabled, XInput backend is not compiled).and XInput is used as a fallback for devices that aren't supported properly by current GameInput backend but are supported by XInput (arcade sticks, racing wheels, flight sticks, etc) (But I haven't tested these devices with GameInput, because I don't have them, that's why I decided to keep XInput).With this PR the detection of my Xbox One controller has changed:
Note that the GUID ends with
6700, which means that this API is actually used. See the line 147 ofthirdparty\sdl\joystick\gdk\SDL_gameinputjoystick.c:TODO:
XInput, RawInput+WGI joystick backendsStill use XInput if GameInput is not enabled from sconsRemoveInput.get_joy_info()["xinput_index"]since XInput is no longer used#define HAVE_XINPUT_H 1get_deps_folder()indetect.pyis no longer neededGAMEINPUT_GetDeviceSubtype: subtype for GameInput controller when DirectInput backend is disabledget_joy_info()) above#define SDL_PLATFORM_WIN32 1TODO to fix regressions:
TODO for separate PRs:
Proper motion sensors support for GameInput backend?Already done upstreamSteam virtual gamepad slotAlready done upstreamSend the power information less frequentlyCompletely disabled upstream at the momentSupport for GameInput v3Already done upstream